<html>
<head>
 
</head>
<body style="text-align=center;font-size:32px;">
<table align="center">
<tr><td><div id="problemNum" style='background-color:#999999;width:800;text-align:center;font-size:32px;'></div></td></tr>
<tr><td><div id="problemContent" style='word-wrap:break-word;background-color:#bbbbbb;width:800;text-align:left;font-size:Npx;'></div></td></tr>
<tr><td><div id="sum" style='word-wrap:break-word; color:#ffff22;font-size:48;background-color:#8855ff;width:800;text-align:center;'></div></td></tr>
<tr><td><div id="copyleft" style='word-wrap:break-word; color:#ffff22;font-size:18;background-color:#666666;width:800;text-align:right;'></div></td></tr>
<script language="javascript">
    //---------------------------------//
    // Project Euler 
    //
    // Author:thrombin
    //   Date:2015-12-13
    //---------------------------------//  
var p_order=15;//Problem Order
 
var problem='Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, \
there are exactly 6 routes to the bottom right corner.\
How many such routes are there through a N×N grid?';
 
 
 
//solve the problem
//==============编程思路简介================
//  采用动态规划
// f(m,n)=f(m-1,n)+f(m,n-1)
//=====================================
var N=21;
var route = new Array(N);
for(var i=0;i<N;i++){
    route[i]=new Array(N);
    for(var j=0;j<N;j++){route[i][j]=0;}
}
route[0][0]=1;
 
for(var i=0;i<N;i++){
    for(var j=0;j<=N;j++){
        if(i>0){route[i][j]+=route[i-1][j];}
        if(j>0){route[i][j]+=route[i][j-1];}
    }
}
 
 
//update browser
document.getElementById("problemNum").innerHTML="Project Euler-Problem "+p_order;
document.getElementById("problemContent").innerHTML=problem;
document.getElementById("sum").innerHTML="Answer:"+route[N-1][N-1];
document.getElementById("copyleft").innerHTML="CopyLeft@Thrombin    N15";
</script>
</body>
</html>